package com.dw.message.controller;



import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dw.common.entitys.BaseResponse;
import com.dw.common.utils.ResultUtils;
import com.dw.model.message.dtos.AddMessageDTO;
import com.dw.model.message.dtos.QueryDetailMessageDTO;
import com.dw.model.message.dtos.QueryMessageDTO;
import com.dw.model.message.entitys.MessageInfo;
import com.dw.message.service.MessageInfoService;
import com.dw.model.message.vos.QueryMessageVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * 聊天信息表(MessageInfo)表控制层
 *
 * @author makejava
 * @since 2024-10-28 08:39:43
 */
@RestController
@RequestMapping("/message")
public class MessageInfoController {

    @Resource
    private MessageInfoService messageInfoService;

    @PostMapping("/add")
    public BaseResponse<Boolean> addMessage(@RequestBody AddMessageDTO addMessageDTO){
        boolean result = messageInfoService.addMessage(addMessageDTO);
        return ResultUtils.success(result);
    }

    /**
     * 分页条件查询消息列表
     */
    @PostMapping("/query")
    public BaseResponse<List<QueryMessageVO>> queryMessage(@RequestBody QueryMessageDTO queryMessageDTO){
        List<QueryMessageVO> result = messageInfoService.queryMessage(queryMessageDTO);
        return ResultUtils.success(result);
    }

    /**
     * 分页条件查询私聊内容
     */
    @PostMapping("/detail")
    public BaseResponse<List<QueryMessageVO>> queryDetailMessage(@RequestBody QueryDetailMessageDTO queryDetailMessageDTO){
        List<QueryMessageVO> result = messageInfoService.queryDetailMessage(queryDetailMessageDTO);
        return ResultUtils.success(result);
    }

}

